package com.igeekhome.controller;

import com.igeekhome.biz.IAttendanceStatisticsService;
import com.igeekhome.biz.ICustomerInfoService;
import com.igeekhome.biz.ICustomerServiceService;
import com.igeekhome.biz.IViewStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

@Controller
public class IndexController {

    @Autowired
    private ICustomerServiceService iCustomerServiceService;

    @Autowired
    private ICustomerInfoService iCustomerInfoService;

    @Autowired
    private IAttendanceStatisticsService iAttendanceStatisticsService;
    @RequestMapping("/")  //当地址栏为http://localhost:80/时，到达登陆页面
    public String index(){
        return "login";
    }
    @RequestMapping("/index")
    public String index2(Model model, HttpSession session){
        session.setAttribute("customerCount",iCustomerInfoService.count());
        session.setAttribute("csCount",iCustomerServiceService.count());
        int i=iAttendanceStatisticsService.count();
        session.setAttribute("AttStaCount",i);
        return "index";
    }
    @RequestMapping("/login")
    public String login(){
        return "login";
    }
    @RequestMapping ("/signup")
    public String signup()
    {
        return "signup";
    }

    @RequestMapping ("/exit")
    public String exit(HttpSession session)
    {
        session.removeAttribute("cs");
        session.removeAttribute("msg");
        return "login";
    }


//    访客列表
    @RequestMapping("/tables")
    public String tables(){
        return "tables";
    }

//    工单列表 全部工单
    @RequestMapping("/workorder")
    public String workorder(){
        return "workorder";
    }

//    工单详情
    @RequestMapping("/detail")
    public String woxiangqing(){
        return "detail";
    }

//    待处理的工单
    @RequestMapping("/daichuli")
    public String daichuli(){
        return "daichuli";
    }

//    我创建的工单
    @RequestMapping("/chuangjian")
    public String chuangjian(){
        return "chuangjian";
    }

}
